home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / docs / misc / ConcNews.lha / news / amiga.programming / comp.sys.amiga.programmer_8989_000050.msg < prev    next >
Encoding:
Text File  |  1994-11-27  |  1.8 KB  |  43 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: dd.chalmers.se!news.chalmers.se!sunic!trane.uninett.no!eunet.no!EU.net!sun4nl!sci.kun.nl!severus.mbfys.kun.nl!rhialto
  3. From: rhialto@mbfys.kun.nl (Olaf Seibert)
  4. Subject: Re: Removing Task started with CreateNewProc
  5. Message-ID: <Co5Cvx.8I2@sci.kun.nl>
  6. Sender: news@sci.kun.nl (News owner)
  7. Nntp-Posting-Host: severus.mbfys.kun.nl
  8. Organization: University of Nijmegen, The Netherlands
  9. References: <rknopCo3z57.Azo@netcom.com>
  10. Date: Tue, 12 Apr 1994 12:47:56 GMT
  11. Lines: 30
  12.  
  13. In <rknopCo3z57.Azo@netcom.com> rknop@netcom.com (Robert Knop) writes:
  14. >I have a parent process that creates a child process with the dos.library
  15. >CreateNewProc, using the NP_Entry tag (as opposed to the NP_SegList tag).
  16. >When I want to finish the task, the parent process sends a message to the
  17. >child process, telling it to clean up.  The child process cleans up
  18. >_everything_ it has allocated, and then does:
  19. >
  20. >ReplyMsg(msg);
  21. >Wait(0L);
  22. >
  23. >When the parent process gets the reply to the "clean up" message, it takes
  24. >that to mean that the child process is cleaned up and ready to be killed, so
  25. >it calls RemTask(childprocess).
  26.  
  27. First, I would add a Forbid() before the ReplyMsg(), so that the parent
  28. can't possibly see the reply before the child has terminated.
  29.  
  30. Second, since it is a DOS *Process*, you can't just call RemTask() on it.
  31. The best way is to have it fall of the edge of the world, in this
  32. case, to let it return from the function you initially started.
  33. It will do the cleanup as is judged necessary by the CreateNewProc()
  34. function.
  35. This also works for Tasks, by the way. In practice, there is rarely
  36. need to RemTask() another Task.
  37.  
  38. >-Rob Knop
  39. -Olaf.
  40. --
  41. ___ Olaf 'Rhialto' Seibert                                 rhialto@mbfys.kun.nl
  42. \X/ An original idea. That can't be too hard. The library must be full of them.
  43.